package com.auxgroup.smarthome.inner.service;

import com.auxgroup.bridge.app.inner.vo.PushRecordVo;
import com.auxgroup.smarthome.BeanListUtils;
import com.auxgroup.smarthome.inner.entity.PushRecordEntity;
import com.auxgroup.smarthome.inner.repo.PushRecordEntityRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by root on 17-10-16.
 */
@Service
public class PushRecordService {

    @Autowired
    private PushRecordEntityRepo pushRecordEntityRepo;

    public List<PushRecordVo> findAllByUid(String uid,String time){
        List<PushRecordEntity> pushRecordEntities = pushRecordEntityRepo.findAllByUidAndPushTimeIsGreaterThanOrderByPushTimeDesc(uid,time);
        return new BeanListUtils(PushRecordVo.class,pushRecordEntities).getTargetList();
    }
}
